/**
 * Created by Administrator on 2017/5/2.
 */
$(function(){
    var nickName,headImg,uid,golds;
    var token = localStorage.getItem('youyuLoginToken');
   var userData = localStorage.getItem('youyuUserData');
    var objUser = $.parseJSON(userData);
    nickName = objUser.nickname;
    headImg = objUser.headimgurl;
    uid ='ID:'+ objUser.uid.substring(0,5);
    $(".headerImg").attr("src",headImg);
    $(".name").text(nickName);
    $(".code").text(uid);
    userGold();
    /*查询用户金币*/
    function userGold(){
        var packUrl = USER_ACCOUNT;
        var curTime = new Date().getTime();
        var uid = $.parseJSON(userData).uid;
        var packParam ={'uid':uid};
        var gold = {
            time: curTime,
            token:token,
            url:packUrl,
            param:packParam,
            sign:$.md5('ts='+curTime+'&mn=3&chid=0&version=1.0&token='+token+'&param='+JSON.stringify(packParam)),
            okCallback:function(data){
                golds = data.data+'金币';
                $('#gold').text(golds);
            },
            errorCallback:function(){
            }
        }
        YY.post(gold);
    }


})
